package Leetcode.Tree.SegmentTree303;

import DataStructure.SegmentTree.SegmentTree;

public class Solution {
    private SegmentTree<Integer> tree;

    public Solution(int[] nums) {
        Integer[] integers = new Integer[nums.length];
        for(int i = 0; i < nums.length; i++) {
            integers[i] = nums[i];
        }
        tree = new SegmentTree<Integer>(integers,((a, b) -> a + b));
    }

    public int sumRange(int i, int j) {
        return  tree.query(i, j);
    }
}
